//package com.moduleSys.web;
//
//import com.moduleSys.entity.system.User;
//import com.moduleSys.mapper.UserMapper;
//import com.moduleSys.service.UserService;
//import com.moduleSys.utils.MD5;
//import org.apache.shiro.SecurityUtils;
//import org.apache.shiro.authc.IncorrectCredentialsException;
//import org.apache.shiro.authc.UnknownAccountException;
//import org.apache.shiro.authc.UsernamePasswordToken;
//import org.apache.shiro.session.Session;
//import org.apache.shiro.subject.Subject;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.websocket.server.PathParam;
//
///**
// * Created by czw on 2017/6/30 0030.
// */
//@RestController
//@RequestMapping(value = "/admin")
//public class IndexController {
//    private static final Logger logger = LoggerFactory.getLogger(IndexController.class);
//
//    @Autowired
//    @Qualifier("userServiceImpl")
//    private UserService userService;
//
//    @Autowired
//    private UserMapper userMapper;
//
//    @RequestMapping(value = "/login", method = {RequestMethod.GET, RequestMethod.POST})
//    public ModelAndView login() {
//        logger.info("loginadmin");
//   /*     User user = new User();
//        user.setUsername("test7");
//        user.setPassword("11");
//        userService.insert(user);*/
//       // User users = userService.getUserById(user.getId());
//      //  logger.info("user ====> " + users.toString());
//        User user2 = userService.selectUserByUserName("dd");
//        logger.info("user2 ====> " + user2.toString());
//        return new ModelAndView("login");
//    }
//
//    @RequestMapping(value = "/index", method = {RequestMethod.GET, RequestMethod.POST})
//    public ModelAndView index() {
//        logger.info("index");
//        User user = userMapper.selectUserByUserName("dd");
//        System.out.println(user.toString());
//        return new ModelAndView("index");
//    }
//
//    @RequestMapping(value = "/page/{index}", method = {RequestMethod.GET, RequestMethod.POST})
//    public ModelAndView page(@PathVariable("index") String index,HttpServletRequest request) {
//        logger.info("page");
//        String ctx = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
//        request.getSession().setAttribute("ctx",ctx);
//        if( "1".equals(index) ){
//            ModelAndView mv = new ModelAndView("/backstage/index");
//            mv.addObject("ctx",ctx);
//            return mv;
//        }
//        return new ModelAndView("index");
//    }
//}
